<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%--
  Created by IntelliJ IDEA.
  User: wsx
  Date: 2017/5/13
  Time: 12:57
  To change this template use File | Settings | File Templates.
--%>
<%@ include file="/WEB-INF/views/include/header.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改商品</title>
    <link rel="stylesheet" href="${Layui}/css/layui.css" media="all">
    <script src="${Layui}/layui.js" charset="utf-8"></script>
    <script src="${jquery}/jquery-3.1.1.js" charset="utf-8"></script>
    <script src="${Js}/admin/purgoods.js" charset="utf-8"></script>
</head>
<body style="margin-left:2px">
<br>

<form class="layui-form" action="/admin/updategoods" method="post" enctype="multipart/form-data">
    <div class="layui-form-item" id="goods-group">
        <div class="input-group">
            <input name="goodsid" value="${croPurgoodsVo.id}" hidden>
            <label class="layui-form-label">商品名称:</label>
            <div class="layui-input-block">
                <input type="text" name="goodname" autocomplete="off" class="layui-input"
                       value="${croPurgoodsVo.goodname}">
            </div>
            <br>
            <label class="layui-form-label">商品数量:</label>
            <div class="layui-input-block">
                <input type="text" name="goodnumber" autocomplete="off" class="layui-input"
                       value="${croPurgoodsVo.goodsnumber}">
            </div>
            <br>
            <label class="layui-form-label">商品类型:</label>
            <div class="layui-input-block">
                <select name="type" lay-verify="required">
                    <option value="11">选择商品类型</option>
                    <c:forEach items="${SysDict['goods_type']}" var="type">
                        <c:if test="${croPurgoodsVo.type==type.key}">
                            <option value="${type.key}" selected>${type.value}</option>
                        </c:if>
                        <c:if test="${croPurgoodsVo.type!=type.key}">
                            <option value="${type.key}">${type.value}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </div>
            <br>
            <label class="layui-form-label">商品价格:</label>
            <div class="layui-input-block">
                <input type="text" name="price" autocomplete="off" class="layui-input"
                       value="${croPurgoodsVo.uniprice}">
            </div>
            <br>
            <label class="layui-form-label">修改图片:</label>
            <div class="layui-input-block">
                <input type="file" name="upload" label="修改图片"/>
                <img src="${croPurgoodsVo.imagurl}" width="32px" height="32px">
                <input name="imgurl" value="${croPurgoodsVo.imagurl}" hidden/>
            </div>
            <%--<label class="layui-form-label">修改商品图片</label>--%>
            <%--<div class="layui-input-block">--%>
            <%--<input type="file" name="upload" label="修改图片" />--%>
            <%--&lt;%&ndash;<img src="${croPurgoodsVo.imagurl}" width="32px" height="32px">&ndash;%&gt;--%>
            <%--</div>--%>
            <br>
            <c:set var="i" value="${0}"/>
            <c:forEach items="${croPurgoodsVo.maps}" var="item">
                <c:set var="i" value="${i+1}"/>
                <input type="text" value="${i}" hidden name="updateflag">
                <label class="layui-form-label">${item.key}</label>
                <div class="layui-input-block" style="width: 200px">
                    <select name="index" lay-verify="required">
                        <option value="-1" selected>选择要修改的值</option>
                        <c:forEach items="${item.value}" var="val">
                            <option value="${val.key}">${val.value}</option>
                        </c:forEach>
                    </select>
                </div>
                <br>
                <div class="layui-input-block" style="width: 150px">
                    <input type="text" name="updatevalue" autocomplete="off" class="layui-input" placeholder="请输入要修改的值"
                           style="width: 200px">
                </div>
                <br>
            </c:forEach>
            <br>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit>提交</button>
            </div>
        </div>
    </div>
</form>
</body>
</html>
